home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / glisp / glisp.000 / GLISP.UNIX.TAR / closunix / closerr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-03  |  3.8 KB  |  165 lines

  1. /*                 GRAPHIC LISP            */
  2. /*        Scritto nel 1991-94 da Zoia Andrea Michele     */
  3. /*        Via Pergola #1 Tirano (SO) Tel. 0342-704210    */
  4. /* file closerr.c */
  5.  
  6. #include "clos.h"
  7.  
  8. int StackTrace=FALSE;
  9. int StackTracing=FALSE;
  10.  
  11. char    *errstrings[E_LAST]={
  12.     "",
  13.         "Duplicate superclass",
  14.     "Bad command line option\n\
  15. Syntax CLOS [option(s)] [files]\n\
  16. Options:\n\
  17. -Nxxxxx nodes          -Sxxxxx string space\n\
  18. -Hxxxxx hash entries   -Ixx max identifier lenght\n\
  19. -Rxx max string lenght -A case-sensitive\n\
  20. -A- no case-sensitive  -C bad char error\n\
  21. -C- bad char warning   -W store options in clos.cfg\n",
  22.     "Control-Break",
  23.     "Stack Overflow",
  24.         "Can't write configfile",
  25.         "Print badvalue",
  26.     "Print badtype",
  27.     "Hash table full: try with command line -H<numhash>",
  28.     "Unmatched class",
  29.     "Ambiguous method: The methods I've matched right are",
  30.     "Unmatched method",
  31.     "Initarg redefinition",
  32.     "Invalid ']'",
  33.     "Identifier truncated",
  34.     "String truncated",
  35.     "Bad char parsed",
  36.     "Too many node pages",
  37.     "Out of nodes space: try with command line -N<numnodes>",
  38.     "Bad type GC",
  39.     "Out of strings space:try with command line -S<numstrings>",
  40.     "GCS1",
  41.     "GCS2",
  42.         "GCS3",
  43.         "EOF reached",
  44.         "Yacc stack overflow",
  45.         "Syntax error",
  46.         "Bad string",
  47.         "Division by 0",
  48.         "Bad identifier lenght",
  49.     "Too many nodes: out of memory",
  50.     "Too many hash entry: out of memory",
  51.     "Too much space for strings: out of memory",
  52.     "Unbound atom",
  53.     "Bad function",
  54.     "Too few arguments",
  55.     "Bad argument(s) type",
  56.     "Bad list",
  57.     "Bad node pointer in setf",
  58.     "Too many arguments",
  59.     "Lambda syntax error",
  60.     "Bad Lambda form",
  61.     "Bad pointer type",
  62.     "Can't open file",
  63.     "Bad string lenght",
  64.     "Unbound function",
  65.     "Bad nodealloc call with numnodes<2",
  66.     "Invalid configuration file:delete it & retry",
  67.     "Label not found",
  68.     "RETURN outside LOOP,DO,DO*,DOTIMES,DOLIST,PROGx",
  69.     "Can't CONTINUE from Top-Level",
  70.     "Accessor redefinition",
  71.     "Defclass syntax error",
  72.     "Can't redefine a class",
  73.         "Unbound class",
  74.         "Bad 3d point",
  75.     "Graph function used in text-mode",
  76.     "Too many points",
  77.     "Math error:Overflow",
  78.     "Math error:",
  79.     "Null node in node_marklist()",
  80.     "String Too Long",
  81.     "Bad NodeCounter (used+free!=total)",
  82.     "GO outside PROG",
  83.     "Out of memory allocating point list in GFILLPOLY",
  84.     "In module closstr2.c"
  85. };
  86.     
  87.  
  88.  
  89. int error( num, type, ptr)
  90. unsigned num;
  91. unsigned type;
  92. void  *ptr;
  93. {
  94.  int print_flag=TRUE;
  95.  switch(type&ERR_MMASK){
  96.     case ERR_MERROR:
  97.         Merror:;
  98.         lisp_print_string("ERROR: ",stderr);
  99.         break;
  100.     case ERR_MWARN:
  101.         lisp_print_string("WARNING: ",stderr);
  102.         break;
  103.     case ERR_MINTERNAL:
  104.         lisp_print_string("INTERNAL ERROR: ",stderr);
  105.         break;
  106.     case ERR_MNONE:
  107.         print_flag=FALSE;
  108.         break;
  109.  
  110.     case ERR_MERRORMSGBOX:
  111. #ifdef _Windows
  112.       print_flag=FALSE;
  113.       if((type&ERR_PMASK)==ERR_PSTRING){
  114.         strcpy(buf1,errstrings[num]);
  115.         strcat(buf1,(char*)ptr);
  116.         BWCCMessageBox(hClosWindow,buf1,"CLOS ERROR",MB_OK);
  117.         break;
  118.       }
  119.       BWCCMessageBox(hClosWindow,errstrings[num],"CLOS ERROR",MB_OK);
  120.       break;
  121. #else
  122.       goto Merror;
  123. #endif
  124.  }
  125.  if(print_flag){
  126.     lisp_print_string(errstrings[num],stderr);
  127.     switch(type&ERR_PMASK){
  128.         case ERR_PVOID:
  129.             break;
  130.         case ERR_PSTRING:
  131.             lisp_print_string(" ",stderr);
  132.             lisp_print_string((char*)ptr,stderr);
  133.             break;
  134.         case ERR_PNODE:
  135.             lisp_print_string(" ",stderr);
  136.             fprint_func(*(node *)ptr,stderr);
  137.             break;
  138.         case ERR_PNINT:
  139.             sprintf(buf1," %lu",*(n_int  *)ptr);
  140.             lisp_print_string(buf1,stderr);
  141.             break;
  142.     }
  143.     lisp_print_string("\n",stderr);
  144.  }
  145.  if(StackTrace && !StackTracing){
  146.    lisp_print_string("trace...\n",stdout);
  147.    StackTracing=TRUE;
  148.    stack_backtrace();
  149.    StackTracing=FALSE;
  150.  }
  151.  switch(type&ERR_TMASK){
  152.     case ERR_TNORM:
  153.         return ERROR;
  154.     case ERR_TCRIT:
  155.         longjmp(critical_jmp,LONGJMP_CRITICAL);
  156.     case ERR_TBLVL:
  157.         longjmp(break_jmp,LONGJMP_ERROR);
  158.  }
  159.  return ERROR;
  160. }
  161.  
  162.  
  163.  
  164.  
  165.